<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>コントロールパネル</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		$(function() {

			// メッセージのフェード
			$('.message').fadeIn("slow");

			// 戻るボタン押下
			$('#btn_back').click(function(){
				document.fm.mode.value = 'back';
				document.fm.submit();
			});
		});
		</script>
		<script type="text/javascript">
			function deleteAction(id){
				if(confirm("削除してもよろしいでしょうか?")){
					window.location.href='shop_form.php?shop_id='+id+'&&mode=delete';
				}else{
					return false;
				}
			} 

			//更新
			function updateAction(){
				if(confirm('更新してよろしいですか？')){
					document.fm2.mode.type="submit";
				}else{
					return false;
				}
			} 

			
		</script>		
		<script type="text/javascript">
			function controlForm(){
				var load = document.getElementById("load");	
				var update = document.getElementById("update");	
				if({{$cnt}}>0){
					load.style.display = 'none';
					update.style.display = 'block';
				}else{
					load.style.display = 'block';
					update.style.display = 'none';
				}
				if({{$cnt}}==''){
					load.style.display = 'block';
					update.style.display = 'none';
				}
			}
		</script>
		
	</head>
	<body id="" onload="controlForm()">
{{ php }} include( MENU_FILE ); {{ /php }}
		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>

		<div id="container"><div class="wrapper">

			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li><a href="consumer_index.php">顧客検索</a></li>								
				<li><a href="consumer_form.php">顧客登録</a></li>
				<li><a href="price_task.php">見積タスク一覧</a></li>
				<li><a href="price_check.php">見積検索</a></li>
				<li>商品マスタ</li>
			</ul>
{{if $cnt!=1}}
<div id="load">
			<h3>商品登録</h3>
			{{ if $phase == 'complete' }}
			<p class="message">登録が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="shop_form.php">一覧へ戻る</a></li>
				<li>&gt;&gt;  <a href="shop_index.php">商品検索</a></li>
			</ul>
			{{ else }}
			
			<ul>						
				<li>＞ <a href="shop_index.php">商品検索</a></li>
				<!-- 
				<li>＞ <a href="price_book.php">価格書</a></li>
				<li>＞ <a href="price_resolution.php">価格決議書</a></li>
				<li>＞ <a href="consumer_price.php">顧客の価格リスト</a></li>
				 -->
			</ul>
			
			<p class="message">情報を入力してください</p>
			
			<form name="fm1" action="shop_form.php" method="post" >
				
				<table class="formTable">
					<tbody>
						<tr>
							<th>※型番</th>
							<td><input type="text" id="type" name="type" class="text" value="{{$forms.type}}" />{{ $err.type }}</td>
						</tr>
						<tr>
							<th>※商品名</th>
							<td>
								<input type="text" id="shop_name" name="shop_name"  style="width: 40em;" class="text" value="{{$forms.shop_name}}" />{{ $err.shop_name }}
							</td>
						</tr>
						<tr>
							<th>※仕様</th>
							<td>
								<input type="radio" id="sty1" name="sty" value="1" {{ if $forms.sty == 1 || $forms.sty=='' }}checked="checked"{{ /if }}  />&nbsp;&nbsp;<input type="text" id="style" name="style1" class="text" value="{{$forms.style1}}" />{{ $err.style1 }}<br/><br/>
								<input type="radio" id="sty2" name="sty" value="2" {{ if $forms.sty == 2 }}checked="checked"{{ /if }} />&nbsp;&nbsp;<input type="text" id="u_style1" name="u_style1" style="width: 40px;" value="{{$forms.u_style1}}" />mm&nbsp;&nbsp;×&nbsp;&nbsp;<input type="text" id="u_style2" name="u_style2" style="width: 40px;" value="{{$forms.u_style2}}" />m
								（ロール品のみ）{{ $err.u_style1 }}
							</td>
						</tr>
						<tr>
							<th>※参考価格</th>
							<td>
								<input style="width:100px" type="text" id="refer_price" name="refer_price" id="text_information" class="text" value="{{$forms.refer_price}}" /> 円&nbsp;{{ $err.refer_price }}
							</td>
						</tr>

						<tr>
							<th>※原価</th>
							<td>
								<input style="width:100px" type="text" id="cost_price" name="cost_price" id="text_information" class="text" value="{{$forms.cost_price}}" /> 円&nbsp;{{ $err.cost_price }}
							</td>
						</tr>

						<tr>
							<th>※単位</th>
							<td>
								<select name="s_unit" style="width: 140px;"  class="text">
									<option {{ if $forms.s_unit == '冊' || $forms.s_unit=='' }}selected{{ /if }} >冊</option>
									<option {{ if $forms.s_unit == '本' }}selected{{ /if }} >本</option>
									<option {{ if $forms.s_unit == '式' }}selected{{ /if }}>式</option>
									<option {{ if $forms.s_unit == '㎡' }}selected{{ /if }}>㎡</option>
									<option {{ if $forms.s_unit == '台' }}selected{{ /if }}>台</option>
									<option {{ if $forms.s_unit == '枚' }}selected{{ /if }}>枚</option>
									<option {{ if $forms.s_unit == '箱' }}selected{{ /if }}>箱</option>
									<option {{ if $forms.s_unit == 'kg' }}selected{{ /if }}>kg</option>
									<option {{ if $forms.s_unit == 'ケース' }}selected{{ /if }}>ケース</option>
									<option {{ if $forms.s_unit == 'セット' }}selected{{ /if }}>セット</option>
									<option {{ if $forms.s_unit == '個' }}selected{{ /if }}>個</option>
									<option {{ if $forms.s_unit == '回' }}selected{{ /if }}>回</option>

								</select>
							</td>
						</tr>

						<tr>
							<th>※申請者</th>
							<td>
								<input type="text" id="applicant" name="applicant" style="width: 40em;" class="text" value="{{$forms.applicant}}" />&nbsp;{{ $err.applicant}}
							</td>
						</tr>

						<tr>
							<th>備考</th>
							<td>
								<textarea rows="3" cols="1"  id="text_information" class="text" name="remark">{{$forms.remark}}</textarea>
							</td>
						</tr>
					</tbody>
				</table>

				<p class="button">
					<button type="submit" class="submit"><span>登録</span></button>
				</p>
				<input type="hidden" name="mode" value="input" />
			</form>
			{{ /if }}
</div>			
{{else}}
<div id="update">
			{{ if $phase == 'completedelete' }}
			<h3>商品削除</h3>	
			<p class="message">削除が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="shop_index.php?{{php}}echo $_SESSION['shop_index_search'];{{/php}}">一覧へ戻る</a></li>
				<li>&gt;&gt; <a href="shop_form.php">商品登録</a></li>
			</ul>
			{{elseif $phase == 'completeupdate' }}
			<h3>商品更新</h3>	
			<p class="message">更新が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="shop_index.php?{{php}}echo $_SESSION['shop_index_search'];{{/php}}">一覧へ戻る</a></li>
				<li>&gt;&gt; <a href="shop_form.php">商品登録</a></li>
			</ul>
			
			{{ else }}
			
			<ul>						
				<li>＞ <a href="shop_index.php">商品検索</a></li>
			</ul>
			
			
					
			<form name="fm2" action="shop_form.php" method="post">
			
				<table class="formTable">

					<tbody>
						<tr>
							<th>登録日</th>
							<td>{{ $v.r_date }}</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td>{{ $v.u_date }}</td>
						</tr>
						<tr>
							<th>商品コード</th>
							<td>{{ $v.id }}</td>
						</tr>
						<tr>
							<th>※型番</th>
							<td><input type="text" name="type" value="{{$v.type}}"  id="text_information" class="text" />{{ $err.type }}</td>
						</tr>
						<tr>
							<th>※商品名</th>
							<td>
								<input type="text" name="shop_name" value="{{$v.shop_name}}"  id="text_information" class="text" />{{ $err.shop_name }}
							</td>
						</tr>
						<tr>
							<th>※仕様</th>
							<td>
								<input type="radio" id="u_sty1" name="sty" value="1" {{ if $v.sty == 1 || $v.sty=='' }}checked="checked"{{ /if }}  />&nbsp;&nbsp;<input type="text" id="u_style" name="style1" value="{{$v.style1}}" />{{ $err.style1 }}<br/><br/>
								<input type="radio" id="u_sty2" name="sty" value="2" {{ if $v.sty == 2 }}checked="checked"{{ /if }}  />&nbsp;&nbsp;<input type="text" id="u_style1" name="u_style1" style="width: 40px;" value="{{$v.u_style1}}" />mm&nbsp;&nbsp;×&nbsp;&nbsp;<input type="text" id="u_style2" name="u_style2" style="width: 40px;" value="{{$v.u_style2}}" />m
								（ロール品のみ）
								{{ $err.u_style1 }}
							</td>
						</tr>
						<tr>
							<th>※参考価格</th>
							<td>
								<input style="width:100px" type="text" name="refer_price" value="{{$v.refer_price}}" id="text_information" class="text" /> 円&nbsp;{{ $err.refer_price }}
							</td>
						</tr>

						<tr>
							<th>※原価</th>
							<td>
								<input style="width:100px" type="text" name="cost_price" value="{{$v.cost_price}}" id="text_information" class="text" /> 円&nbsp;{{ $err.cost_price }}
							</td>
						</tr>

						<tr>
							<th>※単位</th>
							<td>
								<select name="s_unit" style="width: 140px;"  class="text">
									
									<option {{ if $v.s_unit == '冊' || $v.s_unit=='' }}selected{{ /if }} >冊</option>
									<option {{ if $v.s_unit == '本' }}selected{{ /if }} >本</option>
									<option {{ if $v.s_unit == '式' }}selected{{ /if }}>式</option>
									<option {{ if $v.s_unit == '㎡' }}selected{{ /if }}>㎡</option>
									<option {{ if $v.s_unit == '台' }}selected{{ /if }}>台</option>
									<option {{ if $v.s_unit == '枚' }}selected{{ /if }}>枚</option>
									<option {{ if $v.s_unit == '箱' }}selected{{ /if }}>箱</option>
									<option {{ if $v.s_unit == 'kg' }}selected{{ /if }}>kg</option>
									<option {{ if $v.s_unit == 'ケース' }}selected{{ /if }}>ケース</option>
									<option {{ if $v.s_unit == 'セット' }}selected{{ /if }}>セット</option>
									<option {{ if $v.s_unit == '個' }}selected{{ /if }}>個</option>
									<option {{ if $v.s_unit == '回' }}selected{{ /if }}>回</option>
									
								</select>						
							</td>
						</tr>

						<tr>
							<th>※申請者</th>
							<td>
								<input type="text" name="applicant" value="{{$v.applicant}}" id="text_information" class="text" />{{ $err.applicant }}
							</td>
						</tr>

						<tr>
							<th>備考</th>
							<td>
								<textarea rows="3" cols="1" name="remark" id="text_information" class="text">{{$v.remark}}</textarea>
							</td>
						</tr>
						<input type="hidden" name="shop_id" value="{{$v.shop_id}}" />
						<input type="hidden" name="id" value="{{ $v.id }}" />
						<input type="hidden" name="u_date" value="{{$v.u_date}}" />
						<input type="hidden" name="r_date" value="{{$v.r_date}}" />
						<input type="hidden" name="mode" value="update" />
						
					</tbody>


				</table>
				<p class="button">
					<button type="submit"  class="submit" ><span>更新</span></button>
					<button type="button" class="submit" onclick="deleteAction('{{$v.shop_id}}')"><span>削除</span></button>
				</p>				
			</form>
			{{/if}}
</div>
{{/if}}


		</div></div>
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>
	</body>

</html>